#include <iostream>
#include <cmath>

#include "Framebuffer.h"
#include "Vector.h"
#include "Ray.h"
#include "Sphere.h"
#include "Triangle.h"
#include "Camera.h"
#include "ONB.h"

using namespace std;

Sphere s = Sphere(Vector(0,0,0), sqrt(2.0f));
//Triangle t = Triangle(Vector(0,0,-10),Vector(500,0,-10),Vector(0,500,-10));
Ray r = Ray();
ColorRGBA white = ColorRGBA(1.0f,1.0f,1.0f,1.0f);
Camera camera1 = Camera(Vector(0,0,2), Vector(0,0,-2),Vector(0,1,0),2.0f);

void Trace(const ui32 x, const ui32 y, ColorRGBA& c)
{
  r = camera1.GetRay(x,y);

  if (s.Intersect(r) == true/* ||
      t.Intersect(r) == true*/) c.Set(white);
};

i32 main()
{
  Framebuffer f = Framebuffer();
  i32 slot = f.Create(101,101);

  f.Register(slot, &Trace);
  f.Process(slot);

  f.Write(slot, "cameraTrace");
  
  return 0;
}
